{strip}
{include file="common/header.tpl"}
<section class="main">
    <article class="right-col">  
        <h2>{$language.title.user} {if isset($smarty.session.user) && ($smarty.session.user&1<<1) > 0}&raquo; <a href="{$smarty.const.HOST_BACKEND}user/add">{$language.ahref.add}{/if}</a></h2>
        <form name="frmSearch" id="frmSearch" action="{$smarty.const.HOST_BACKEND}user/index" onsubmit="javascript:return actionSearch();" method="get" enctype="multipart/form-data">
        
            {include file="user/search.tpl"}
        </form>
        		
        <form id="frmAdmin" name="frmAdmin" method="post" action="{$smarty.const.HOST_BACKEND}user/act" enctype="multipart/form-data">
            <input type="hidden" name="paction" id="paction" />
            <input type="hidden" name="pcancelsearch" id="pcancelsearch"/>
            {if $arrResult}
                {if ($smarty.session.user) > 0}
                    <div class="s-button">
						{if ($smarty.session.user&1<<5) > 0}
                            <button type="button" onclick="javascript:confirmActive(this.form);">{$language.btn.active}</button>
                            <button type="button" onclick="javascript:act(this.form,4);">{$language.btn.inactive}</button>
                        {/if} 
                        {if ($smarty.session.user&1<<4) > 0}
                            <button type="button" onclick="javascript:confirmPending(this.form);">{$language.btn.suspend}</button>
                        {/if} 
                        {if ($smarty.session.user&1<<3) > 0}
                            <button type="button" onclick="javascript:confirmDelete(this.form);">{$language.btn.delete}</button>
                        {/if}                                                                                                            
                    </div>
                {/if}
            {if isset($arrResult) && is_array($arrResult)}
                <div class="s-page">
                    <strong class="total">{$language.common.total}: {$intTotal}</strong>
                    {paging total=$intTotal limit=$intLimit offset=$intOffset}
                </div>
            {/if}
            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="list">
                <thead>
                    <tr>
                        <th class="16"><input type="checkbox" name="pcheckall" id="pcheckall" onclick="javascript:checkAll(this.form,'puserid[]',this.checked);"/></th>
                        <th class="150">{$language.label.username}</th>
                        <th class="150">{$language.label.fullname}</th>
                        <th class="80">{$language.label.email}</th>
                        <th class="80">{$language.label.status}</th>
                        <th>&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach key=i item=item from=$arrResult}
						<tr>
							<td align="center">
                            <input type="checkbox" id="puserid{$item.userid}" name="puserid[]" value="{$item.userid}" onclick="javascript:checkOneItem(this.form, 'pcheckall')"/></td>
							<td>{$item.username}</td>							
							<td>{$item.lastname}{$item.firstname}</td>
							<td>{$item.email}</td>
							<td>
                            		{if $item.status == 0}
                                        <img src="{$smarty.const.HOST_STATICS}admin/img/ad-unaccept.png" width="16" height="" alt="Tạm dừng" border="0" title="Tạm dừng" />
                                    {elseif $item.status == 1}
                                         <img src="{$smarty.const.HOST_STATICS}admin/img/ad-accept.png" alt="Đang kích hoạt" border="0" width="16" height="16" />
                                    {elseif $item.status == 2}
                                        <img src="{$smarty.const.HOST_STATICS}admin/img/un-accept.png" alt="Bị đình chỉ" border="0" width="16" height="16" />
                                 
                                 	{elseif $item.status == 4}
                                        <img src="{$smarty.const.HOST_STATICS}admin/img/ad-delete.png" alt="Bị xóa" border="0" width="16" height="16" />
                                 {/if}
                            </td>
							<td>
                            {if ($smarty.session.user) > 0}
                            	{if (($smarty.session.user&1<<2)>0)}
                                <a href="{$smarty.const.HOST_BACKEND}user/edit?userid={$item.userid}">{$language.ahref.edit}</a>&nbsp;|&nbsp;
                                 <a href="{$smarty.const.HOST_BACKEND}user/changemail?userid={$item.userid}">{$language.ahref.changeemail}</a>&nbsp;|&nbsp;                              
                                <a href="{$smarty.const.HOST_BACKEND}user/changepw?userid={$item.userid}">{$language.ahref.changepw}</a>&nbsp;|&nbsp;
                            	{/if}
                                {if ($smarty.session.user&1<<0)>0}
                                <a href="{$smarty.const.HOST_BACKEND}user/detail?userid={$item.userid}">{$language.ahref.detail}</a>
                                {/if}
                           {/if}
                            </td>
						</tr>
					{/foreach}
                </tbody>
            </table>
            {if isset($arrResult) && is_array($arrResult)}
                <div class="s-page">
                    <strong class="total">{$language.common.total}: {$intTotal}</strong>
                    {paging total=$intTotal limit=$intLimit offset=$intOffset}
                </div>
            {/if}
				{if ($smarty.session.user) > 0}
                    <div class="s-button">
						{if ($smarty.session.user&1<<5) > 0}
                            <button type="button" onclick="javascript:confirmActive(this.form);">{$language.btn.active}</button>
                        {/if}                                                                                  
                        {if ($smarty.session.user&1<<3) > 0}  
                            <button type="button" onclick="javascript:confirmDelete(this.form);">{$language.btn.inactive}</button>
                            
                        {/if}
                        {if ($smarty.session.user&1<<4) > 0}
                            <button type="button" onclick="javascript:confirmPending(this.form);">{$language.btn.suspend}</button>
                        {/if}  
                        {if ($smarty.session.user&1<<3) > 0}
                            <button type="button" onclick="javascript:confirmDelete(this.form);">{$language.btn.delete}</button>
                        {/if}                       
                    </div>
                {/if}         
             {/if}
        </form>
	</article>
</section>
{include file="common/footer.tpl"}
{/strip}
                
